package com.ds;

import com.ds.bpm.engine.BPMConstants;
import com.ds.common.JDSException;
import com.ds.common.logging.Log;
import com.ds.common.logging.LogFactory;
import com.ds.esb.config.manager.EsbBeanFactory;
import com.ds.esb.config.manager.ExpressionTempBean;
import com.ds.esb.config.manager.ServiceBean;
import com.ds.esb.util.EsbFactory;
import com.ds.server.JDSServer;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import java.util.List;

public class JDSInit extends HttpServlet {
    private static final Log logger = LogFactory.getLog(
            BPMConstants.CONFIG_KEY, JDSInit.class);

    private static final long serialVersionUID = -7181186633660301865L;

    @Override
    public void init() throws ServletException {
        System.out.println(">>>>>>>>>>>>>>启动");
        try {
            JDSServer.getInstance();
            EsbFactory.initBus();


            final List<? extends ServiceBean> list = EsbBeanFactory.getInstance().loadAllServiceBean();
            for (int k = 0; k < list.size(); k++) {
                if (!(list.get(k) instanceof ExpressionTempBean)) {
                    continue;
                }
                final ExpressionTempBean bean = (ExpressionTempBean) list.get(k);
                System.out.println(bean.getName() + bean.getExpressionArr());

            }

//		final ClusterClient client=JDSServer.getClusterClient();
//	    client.login();

        } catch (final JDSException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}
